<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        //其它类型转化为 字符串  toString() 方法  String(**)强转    加''
        var num=10;
        console.log(typeof num.toString());

        console.log(typeof String(num));

        console.log(typeof (num+''));


        //转化为数字型(重点)   parseInt()   parseFloat   Number()强转   隐式转化 ''-0

        console.log(typeof ('12'-0));
        console.log('12'-0);

        console.log("%c%s",
            "color: red; background: yellow; font-size: 20px;",
            typeof ('12'-0));

        console.log(parseInt('3.14'))     //3
        console.log(parseInt('3.94'))     //3   不会四舍五入
        console.log(parseInt('120px'))    //120
        console.log(parseInt('rem120'))   //NaN


        console.log(parseFloat('3.14'))    //3.14
        console.log(parseFloat('120px'))  //120

        console.log(Number('12'));

        console.log('123'-'12');

        //转化为Boolean 类型    '' 0  null  undefined   NaN  会转化为false
        //其余的都是  true

        console.log(Boolean(''));
        console.log(Boolean(0));
        console.log(Boolean(null));
        console.log(Boolean(undefined));
        console.log(Boolean(NaN));
        console.log(Boolean('鲁大师'-100));   //里面时NaN


        console.log(Boolean('卡机'))   //true
        console.log(Boolean('123'))    //true
        console.log(Boolean(123))    //true




    </script>
</head>
<body>

</body>
</html>